<template>
  <div>
    <div v-for="(item, index) in account" :key="index">
      <order-msg :Account="item" :accItem="item[0]"></order-msg>
      <!-- <div @click="del">删除</div> -->
    </div>
  </div>
</template>

<script>
import OrderMsg from "../components/OrderMsg.vue";
export default {
  data() {
    return {
      account: [],
    };
  },
  components: { OrderMsg },
  created() {
    console.log("ddddd");
    this.FindOrder();
  },
  methods: {
    FindOrder() {
      this.axios({
        method: "get",
        url: "/findOrder",
        params: {
          status: 1,
        },
      })
        .then((res) => {
          console.log("res 订单==>", res);
          if (res.data.code === 70000) {
            let accountData = res.data.result;

            console.log(res);
            let count = 0;
            let array = []; //第一层数组
            for (let i = 0; i < accountData.length; i++) {
              accountData.splice(0, count); //splice返回被删除的元素
              if (accountData.length != 0) {
                // arr是oid相同的数组 第二层数组
                let arr = accountData.filter((item, index) => {
                  return accountData[0].oid === item.oid;
                });
                array.push(arr);
                count = arr.length;
                // console.log('arr===>',arr);
                arr = [];
                i = 0;
              }
            }
            this.account = array;
          }
          console.log("this.account==>", this.account);
          console.log(res);
        })
        .catch((err) => {
          console.log("err==>", err);
        });
    },
  },
};
</script>

<style lang="less" scoped>
</style>